/*
 * @Author       : 魏威 <1209562577@qq.com>
 * @Date         : 2021-09-26 19:27 周0
 * @Description  : 登录页
 */

import { Form, Input } from 'antd';
import { useAuthContext } from 'context/auth-context';
import React from 'react';
import { LongButton } from 'unauthenticated-app';
export default function LoginScreen() {
  const { login } = useAuthContext();

  const handleSubmit = (values: { username: string; password: string }) => {
    login(values);
  };

  return (
    <Form onFinish={handleSubmit}>
      <Form.Item
        name={'username'}
        rules={[{ required: true, message: '请输入用户名' }]}
      >
        <Input placeholder={'用户名'} type="text" id={'username'} />
      </Form.Item>
      <Form.Item
        name={'password'}
        rules={[{ required: true, message: '请输入密码' }]}
      >
        <Input placeholder={'密码'} type="text" id={'password'} />
      </Form.Item>

      <Form.Item>
        <LongButton htmlType={'submit'} type="primary">
          登录
        </LongButton>
      </Form.Item>
    </Form>
  );
}
